home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / VIRUS.BAT < prev    next >
DOS Batch File  |  1992-09-19  |  3KB  |  84 lines

  1. @echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Virus testbench based on directory comparisons    │
  5. echo │ By Prof. Timo Salmi, ts@uwasa.fi, Sat 19-Sep-1992 │
  6. echo └───────────────────────────────────────────────────┘
  7.  
  8. if "%1"=="" goto _help
  9.  
  10. rem Do some housekeeping
  11. if exist diffe.$$$ del diffe.$$$
  12.  
  13. rem Make an ex-ante directory for comparison. Add more directories
  14. rem and files as you deem fit
  15. dir *.* > tmp.$$$
  16. if exist *.exe dir *.exe >> tmp.$$$
  17. if exist *.com dir *.com >> tmp.$$$
  18. type tmp.$$$ | find /v "bytes" | find /v "TMP      $$$" > before.$$$
  19. if exist tmp.$$$ del tmp.$$$
  20.  
  21. rem Run the suspect program (at your own risk!)
  22. set program_=
  23. :_loop
  24. set program_=%program_% %1
  25. shift
  26. if not "%1"=="" goto _loop
  27. call %program_%
  28.  
  29. rem Make an ex-post directory for the comparison
  30. dir *.* > tmp.$$$
  31. if exist *.exe dir *.exe >> tmp.$$$
  32. if exist *.com dir *.com >> tmp.$$$           
  33. type tmp.$$$ | find /v "bytes" | find /v "BEFORE   $$$" | find /v "TMP      $$$" > after.$$$
  34. if exist tmp.$$$ del tmp.$$$
  35.  
  36. rem Check for changes using the external MsDos fc.exe file compare and
  37. rem MsDos find.exe text search utilities
  38. fc after.$$$ before.$$$ > tmp.$$$
  39. type tmp.$$$ | find "no differences encountered" > same.$$$
  40. del tmp.$$$
  41. if exist nodiffe.$$$ del nodiffe.$$$
  42. copy same.$$$ nodiffe.$$$ > nul
  43. if exist same.$$$ del same.$$$
  44. if not exist nodiffe.$$$ goto _differ
  45.  
  46. rem No changes have occurred
  47. echo ┌─────────────────────────────────────────────────────────┐
  48. echo │ The scanned directories and files have not been changed │
  49. echo └─────────────────────────────────────────────────────────┘
  50. goto _out
  51.  
  52. :_differ
  53. fc before.$$$ after.$$$ > diffe.$$$
  54. echo ┌────────────────────────────────────────────────────────────────┐
  55. echo │ Warning: The scanned directories and files have been changed   │
  56. echo │ See diffe.$$$ for details                                      │
  57. echo └────────────────────────────────────────────────────────────────┘
  58. goto _out
  59.  
  60. :_help
  61. echo.
  62. echo Usage: VIRUS SuspectProgram [parameter1] [parameter2] [...]
  63. echo.
  64. echo This batch makes a directory both prior and after running the
  65. echo suspect program, and gives a warning if the directories differ,
  66. echo and prepares a list of the differences.
  67. echo.
  68. echo This batch can be also used by a knowledgeable user for the more
  69. echo benevolent similar purpose of checking what files a certain programs
  70. echo changes.
  71. echo.
  72. echo If you get an "Out of environment space" message, increase your
  73. echo environment space by using shell configuration in config.sys:
  74. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  75. goto _out2
  76.  
  77. :_out
  78. if exist nodiffe.$$$ del nodiffe.$$$
  79. if exist before.$$$ del before.$$$
  80. if exist after.$$$ del after.$$$
  81. :_out2
  82. set program_=
  83. echo on
  84.